package com.apollow.oschina.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.apollow.oschina.R;
import com.apollow.oschina.base.BaseActivity;
import com.apollow.oschina.base.Global;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by bobo on 2017/1/17.
 */

public class LoginActivity extends BaseActivity {

    public static final int REQUEST_CODE_INIT = 0;
    private static final String BUNDLE_KEY_REQUEST_CODE = "BUNDLE_KEY_REQUEST_CODE";
    protected static final String TAG = LoginActivity.class.getSimpleName();

    @BindView(R.id.et_username)
    AutoCompleteTextView mEtUsername;
    @BindView(R.id.iv_clear_username)
    ImageView mIvClearUsername;
    @BindView(R.id.et_password)
    EditText mEtPassword;
    @BindView(R.id.iv_clear_password)
    ImageView mIvClearPassword;
    @BindView(R.id.btn_login)
    Button mBtnLogin;
    @BindView(R.id.qq_login)
    Button mQqLogin;

    private final int requestCode = REQUEST_CODE_INIT;
    private String mUserName;
    private String mPassword;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.btn_login, R.id.qq_login,R.id.iv_clear_username, R.id.iv_clear_password})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_clear_username:
                mEtUsername.getText().clear();
                mEtUsername.requestFocus();
                break;
            case R.id.iv_clear_password:
                mEtPassword.getText().clear();
                mEtPassword.requestFocus();
                break;
            case R.id.btn_login:
                Global.showToast("登录");
                handleLogin();
                break;
            case R.id.qq_login:
                Global.showToast("QQ登录");
                break;
        }
    }

    private void handleLogin() {

    }

}
